import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
import getters from './getters'

Vue.use(Vuex)

const store = new Vuex.Store({
  state:{
    //用户流程
    userTableData: [],
    userEditData: [],
    //工单流程
    flowList: [],
    modelList: [],
    bindingList: [],
    //我的工单
    workOrderTypeList: '',
    creatWorkOrder: [],
    creatTableData: [],
    step:'1',

  },
  mutations:{
    //用户管理
    userTableList(state,obj){
      state.userTableData = obj;
    },
    userEditMethod(state,t){
      state.userEditData = t;
    },
    userEditClear(state){
      state.userEditData = '';
    },
    // 工单流程
    flowListMethod(state,list){
      state.flowList = list;
    },
    modelListMethod(state,list2){
      state.modelList.push(list2);
    },
    modelListMethodClear(state){
      state.modelList = [];
    },
    bindingListPush(state,bindingList){
      state.bindingList.push(bindingList);
    },
    bindingListClear(state){
      state.bindingList = [];
    },
    //我的工单
    workOrderTypeListPush(state,list){
      state.workOrderTypeList.push(list);
    },
    workOrderTypeListClear(state){
      state.workOrderTypeList = [];
    },
    //创建工单
    creatWorkOrderPush(state,list){
      state.creatWorkOrder.push(list);
    },
    creatWorkOrderClear(state){
      state.creatWorkOrder = [];
    },
    creatTableDataPush(state,proid){
      state.creatTableData[proid] = [];
    },
    changeStep1(state){
      state.step = '2';
    },
    changeStep2(state){
      state.step = '3';
    },
  },
  getters:{

  },
  actions:{

  },
  modules: {
    app,
    user,
    permission
  },
  getters
})

export default store
